package com.itheima.mapper;

import com.itheima.pojo.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Set;

public interface RoleAdminMapper {

    @Select("select * from t_role")
    List<Role> findRoleAll();

    Integer[] findRoleIdsByUserId(@Param("id") Integer id);

    List<Role> findPage(@Param("queryString") String queryString);

    @Select("select permission_id from t_role_permission where role_id=#{id}")
    List<Integer> findRoleAndPermissionById(@Param("id") Integer id);

    @Select("select name from t_permission where id=#{permissionId}")
    String findPermissionName(@Param("permissionId") Integer permissionId);

    void add(Role role);

    void addRoleAndPermission(@Param("roleId") Integer roleId,@Param("permissionId") Integer permissionId);

    void deleteRoleAdminById(@Param("id") Integer id);

    void removeRoleAndPermissionByRoleId(@Param("roleId") Integer roleId);

    void edit(Role role);

}
